package com.qumitech.visualnovel.controller.vo.basic;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;

import java.text.NumberFormat;
import java.util.Date;

/**
 * @Author :  ZhChNing
 * @Descriptiom :
 * @Date Created in 2019/3/12 16:20
 */
public class StartChannelBasicStatisticsDataVO {

    @JSONField(name = "app_id")
    private String appId;
    @JSONField(name = "start_app_channel")
    private String startAppChannel;
    @JSONField(name = "app_name")
    private String appName;
    @JSONField(name = "app_version")
    private String appVersion;
    @JSONField(name = "target_date")
    private Date targetDate;
    @JSONField(name = "activate_count")
    private Integer activateCount;
    @JSONField(name = "register_count")
    private Integer registerCount;
    @JSONField(name = "active_count")
    private Integer activeCount;
    @JSONField(name = "register_rate")
    private String registerRate;



    public Integer getRegisterCount() {
        return registerCount;
    }

    public void setRegisterCount(Integer registerCount) {
        this.registerCount = registerCount;
    }

    public Integer getActivateCount() {
        return activateCount;
    }

    public void setActivateCount(Integer activateCount) {
        this.activateCount = activateCount;
    }

    public Integer getActiveCount() {
        return activeCount;
    }

    public void setActiveCount(Integer activeCount) {
        this.activeCount = activeCount;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }


    public String getAppName() {
        return appName;
    }

    public void setAppName(String appName) {
        this.appName = appName;
    }

    public String getAppVersion() {
        return appVersion;
    }

    public void setAppVersion(String appVersion) {
        this.appVersion = appVersion;
    }

    public String getStartAppChannel() {
        return startAppChannel;
    }

    public void setStartAppChannel(String startAppChannel) {
        this.startAppChannel = startAppChannel;
    }

    public String getRegisterRate() {
        return registerRate;
    }

    public void setRegisterRate(String registerRate) {
        this.registerRate = registerRate;
    }

    public void calculateRegisterRate(){
        if (activateCount == 0){
            registerRate = "-";
        }
        else {
            NumberFormat nt = NumberFormat.getPercentInstance();
            nt.setMinimumFractionDigits(2);
            registerRate = nt.format(registerCount*1.00 / activateCount);
        }
    }

    public Date getTargetDate() {
        return targetDate;
    }

    public void setTargetDate(Date targetDate) {
        this.targetDate = targetDate;
    }
}
